﻿Imports System.Data.OleDb
Public Class _new
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub


    Protected Sub btSubmit_Click(sender As Object, e As EventArgs) Handles btSubmit.Click

        flImage.SaveAs(Request.MapPath("uploads") & "/" & flImage.FileName)


        Dim oleDbConn As New OleDb.OleDbConnection(ConfigurationManager.ConnectionStrings("ConnectionStringx").ConnectionString)
        Dim SqlString As String = "Insert into users (username, [password], email, location, bike, tagline, [image]) Values (@f1, @f2, @f3, @f4, @f5, @f6, @f7)"
        'Dim SqlString As String = "INSERT into users (username, [password]) VALUES ('a','b')"     channel, @f9
        Dim cmd As OleDbCommand = New OleDbCommand(SqlString, oleDbConn)
        cmd.CommandType = CommandType.Text
        cmd.Parameters.AddWithValue("@f1", txtUserName.Text)
        cmd.Parameters.AddWithValue("@f2", txtPassword.Text)
        cmd.Parameters.AddWithValue("@f3", txtEmail.Text)
        '  cmd.Parameters.AddWithValue("@f4", drpSex.DataValueField)
        cmd.Parameters.AddWithValue("@f4", txtLocation.Text)
        '  cmd.Parameters.AddWithValue("@f5", txtAge.Text)

        ' favourite_thing()

        cmd.Parameters.AddWithValue("@f5", txtBike.Text)
        ' cmd.Parameters.AddWithValue("@f9", txtChannel.Text)
        cmd.Parameters.AddWithValue("@f6", txtTag.Text)
        ' cmd.Parameters.AddWithValue("@f12", drpDOB.SelectedDate)
        cmd.Parameters.AddWithValue("@f7", "uploads/" & flImage.FileName)



        oleDbConn.Open()
        cmd.ExecuteNonQuery()
        cmd.Dispose()
        oleDbConn.Close()
        '   MsgBox("Record Added.", MsgBoxStyle.Information)
        Response.Redirect("list.aspx")



    End Sub
End Class